package azcat.planner.gui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
import javax.swing.JTabbedPane;
import javax.swing.border.LineBorder;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import javax.swing.JButton;
import java.awt.Dialog.ModalExclusionType;
import javax.swing.JLabel;
import javax.swing.JCheckBox;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.RowSpec;
import javax.swing.SpringLayout;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import com.jgoodies.forms.factories.FormFactory;
import net.miginfocom.swing.MigLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Button;
import java.awt.Checkbox;
import java.awt.event.ItemListener;
import java.awt.event.ItemEvent;
import java.util.ArrayList;

public class MaterialsType extends JFrame implements ItemListener{

	private JPanel outsidePanel;
	private JTabbedPane tabContainer;
	private JPanel polietilenoTab;
	private JPanel rpvcTab;
	private JPanel crosslinkTab;
	private JCheckBox chckbxPoliti9;
	private JCheckBox chckbxPoliti2;
	private JCheckBox chckbxPoliti7;
	private JCheckBox chckbxPoliti1;
	private JCheckBox chckbxPoliti8;
	private JCheckBox chckbxPoliti10;
	private JCheckBox chckbxPoliti3;
	private JCheckBox chckbxPoliti11;
	private JCheckBox chckbxPoliti4;
	private JCheckBox chckbxPoliti6;
	private JPanel polietilenoPanel;
	private JCheckBox chckbxPoliti5;
	private JCheckBox chckbxPoliti12;
	private JPanel rpvcPanel;
	private JCheckBox chckbxNewCheckBox;
	private JCheckBox chckbxNewCheckBox_1;
	private JCheckBox chckbxNewCheckBox_2;
	private JCheckBox chckbxNewCheckBox_3;
	private JCheckBox chckbxNewCheckBox_4;
	private JPanel crosslinkPanel;
	private JCheckBox chckbxNewCheckBox_5;
	private JCheckBox chckbxNewCheckBox_6;
	private JPanel buttonsPanel;
	private JButton btnAceptar;
	private JButton btnCancelar;
	private JPanel absTab;
	private JPanel absPanel;
	private JCheckBox chckbxNewCheckBox_7;
	private JCheckBox chckbxNewCheckBox_8;
	private JCheckBox chckbxNewCheckBox_9;
	private JCheckBox chckbxNewCheckBox_10;
	private JCheckBox chckbxNewCheckBox_11;
	private JCheckBox chckbxNewCheckBox_12;
	private JCheckBox chckbxNewCheckBox_13;
	private JCheckBox chckbxNewCheckBox_14;
	private JCheckBox chckbxNewCheckBox_15;
	private JCheckBox chckbxNewCheckBox_16;
	private JPanel burbujaTab;
	private JPanel burbujaPanel;
	private JCheckBox chckbxNewCheckBox_17;
	private JCheckBox chckbxNewCheckBox_18;
	private JCheckBox chckbxNewCheckBox_19;
	private JCheckBox chckbxNewCheckBox_20;
	private JPanel cartonTab;
	private JPanel cartonPanel;
	private JCheckBox chckbxNewCheckBox_21;
	private JCheckBox chckbxNewCheckBox_22;
	private JCheckBox chckbxNewCheckBox_23;
	private JCheckBox chckbxNewCheckBox_24;
	private JPanel foamTab;
	private JPanel plasticoTab;
	private JPanel foamPanel;
	private JPanel plasticoPanel;
	private JCheckBox chckbxNewCheckBox_25;
	private JCheckBox chckbxNewCheckBox_26;
	private JCheckBox chckbxNewCheckBox_27;
	private JCheckBox chckbxNewCheckBox_28;
	private JCheckBox chckbxNewCheckBox_29;
	private JCheckBox chckbxNewCheckBox_30;
	private JCheckBox chckbxNewCheckBox_31;
	private JCheckBox chckbxNewCheckBox_32;
	private JCheckBox chckbxNewCheckBox_33;
	private JCheckBox chckbxNewCheckBox_34;
	
	

	/**
	 * Launch the application.
	 */
//	public static void main(String[] args) {
//		EventQueue.invokeLater(new Runnable() {
//			public void run() {
//				try {
//					UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//					MaterialsType frame = new MaterialsType();
//					frame.setVisible(true);
//				} catch (Exception e) {
//					e.printStackTrace();
//				}
//			}
//		});
//	}

	/**
	 * Create the frame.
	 */
	public MaterialsType() {
		setResizable(false);
		setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
		setTitle("Tipo de Materiales");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		outsidePanel = new JPanel();		
		setContentPane(outsidePanel);
		outsidePanel.setLayout(new BorderLayout(0, 0));
		
		tabContainer = new JTabbedPane(JTabbedPane.TOP);
		outsidePanel.add(tabContainer);
		
		polietilenoTab = new JPanel();
		tabContainer.addTab("Polietileno", null, polietilenoTab, "Placas de Polietileno");
		polietilenoTab.setLayout(new BorderLayout(0, 0));
		
		polietilenoPanel = new JPanel();
		polietilenoTab.add(polietilenoPanel, BorderLayout.CENTER);
		polietilenoPanel.setLayout(new MigLayout("", "[214px][214px]", "[33px][33px][33px][33px][33px][33px]"));
		
		chckbxPoliti1 = new JCheckBox("1.2# 1\u201D x 48\u201D x 108\u201D");
		
		chckbxPoliti1.addItemListener(this);
		polietilenoPanel.add(chckbxPoliti1, "cell 0 0,grow");
		
		chckbxPoliti7 = new JCheckBox("1.7# 2\u201D x 48\u201D x 108\u201D");
		polietilenoPanel.add(chckbxPoliti7, "cell 1 0,grow");
		
		chckbxPoliti2 = new JCheckBox("1.2# 1.5\u201D x 48\u201D x 108\u201D");
		polietilenoPanel.add(chckbxPoliti2, "cell 0 1,grow");
		
		chckbxPoliti8 = new JCheckBox("1.7# 3\u201D x 48\u201D x 108\u201D");
		polietilenoPanel.add(chckbxPoliti8, "cell 1 1,grow");
		
		chckbxPoliti3 = new JCheckBox("1.2# 2\u201D x 48\u201D x 108\u201D");
		polietilenoPanel.add(chckbxPoliti3, "cell 0 2,grow");
		
		chckbxPoliti9 = new JCheckBox("2.2# 1\u201D x 48\u201D x 108\u201D");
		polietilenoPanel.add(chckbxPoliti9, "cell 1 2,grow");
		
		chckbxPoliti4 = new JCheckBox("1.2# 3\u201D x 48\u201D x 108\u201D");
		polietilenoPanel.add(chckbxPoliti4, "cell 0 3,grow");
		
		chckbxPoliti10 = new JCheckBox("2.2# 1.5\u201D x 48\u201D x 108\u201D");
		polietilenoPanel.add(chckbxPoliti10, "cell 1 3,grow");
		
		chckbxPoliti5 = new JCheckBox("1.7# 1\u201D x 48\u201D x 108\u201D");
		polietilenoPanel.add(chckbxPoliti5, "cell 0 4,grow");
		
		chckbxPoliti11 = new JCheckBox("2.2# 2\u201D x 48\u201D x 108\u201D");
		polietilenoPanel.add(chckbxPoliti11, "cell 1 4,grow");
		
		chckbxPoliti6 = new JCheckBox("1.7# 1.5\u201D x 48\u201D x 108\u201D");
		polietilenoPanel.add(chckbxPoliti6, "cell 0 5,grow");
		
		chckbxPoliti12 = new JCheckBox("2.2# 3\u201D x 48\u201D x 108\u201D");
		polietilenoPanel.add(chckbxPoliti12, "cell 1 5,grow");
		
		rpvcTab = new JPanel();
		tabContainer.addTab("RPVC  ", null, rpvcTab, null);
		tabContainer.setEnabledAt(1, true);
		rpvcTab.setLayout(new BorderLayout(0, 0));
		
		rpvcPanel = new JPanel();
		rpvcTab.add(rpvcPanel, BorderLayout.CENTER);
		rpvcPanel.setLayout(new MigLayout("", "[214px][214px]", "[33px][33px][33px][33px][33px][33px]"));
		
		chckbxNewCheckBox_3 = new JCheckBox("RPVC clear 0.015\u201D x 26\u201D");
		rpvcPanel.add(chckbxNewCheckBox_3, "cell 0 0,grow");
		
		chckbxNewCheckBox_1 = new JCheckBox("RPVC 0.040\u201D x 26\u201D");
		rpvcPanel.add(chckbxNewCheckBox_1, "cell 0 1,grow");
		
		chckbxNewCheckBox_4 = new JCheckBox("RPVC 0.015\u201D x 24 water clear");
		rpvcPanel.add(chckbxNewCheckBox_4, "cell 0 2,grow");
		
		chckbxNewCheckBox_2 = new JCheckBox("RPVC 0.040\u201D x 31.5\u201D");
		rpvcPanel.add(chckbxNewCheckBox_2, "cell 0 3,grow");
		
		chckbxNewCheckBox = new JCheckBox("PET GAG 0.040\u201D x 28.5\u201D");
		rpvcPanel.add(chckbxNewCheckBox, "cell 0 4,grow");
		
		crosslinkTab = new JPanel();
		tabContainer.addTab("Crosslink", null, crosslinkTab, null);
		crosslinkTab.setLayout(new BorderLayout(0, 0));
		
		crosslinkPanel = new JPanel();
		crosslinkTab.add(crosslinkPanel, BorderLayout.CENTER);
		crosslinkPanel.setLayout(new MigLayout("", "[214px][214px]", "[33px][33px][33px][33px][33px][33px]"));
		
		chckbxNewCheckBox_6 = new JCheckBox("PE  2# 4\u201D x 48\u201D x 96\u201D");
		crosslinkPanel.add(chckbxNewCheckBox_6, "cell 0 0,grow");
		
		chckbxNewCheckBox_5 = new JCheckBox("PE  4# 4\u201D x 48\u201D x 96\u201D");
		crosslinkPanel.add(chckbxNewCheckBox_5, "cell 0 1,grow");
		
		absTab = new JPanel();
		tabContainer.addTab("ABS   ", null, absTab, null);
		absTab.setLayout(new BorderLayout(0, 0));
		
		absPanel = new JPanel();
		absTab.add(absPanel, BorderLayout.CENTER);
		absPanel.setLayout(new MigLayout("", "[214px][214px]", "[33px][33px][33px][33px][33px][33px]"));
		
		chckbxNewCheckBox_7 = new JCheckBox("0.230\u201D x 26.25\u201D x 42.75\u201D");
		absPanel.add(chckbxNewCheckBox_7, "cell 0 0");
		
		chckbxNewCheckBox_13 = new JCheckBox("0.090\u201D x 31\u201D x 38\u201D");
		absPanel.add(chckbxNewCheckBox_13, "cell 1 0");
		
		chckbxNewCheckBox_8 = new JCheckBox("0.187\u201D x 26\u201D x 27\u201D");
		absPanel.add(chckbxNewCheckBox_8, "cell 0 1");
		
		chckbxNewCheckBox_14 = new JCheckBox("0.090\u201D x 30.5\u201D x 35.5\u201D");
		absPanel.add(chckbxNewCheckBox_14, "cell 1 1");
		
		chckbxNewCheckBox_9 = new JCheckBox("0.165\u201D x 19.5\u201D x 23.5\u201D");
		absPanel.add(chckbxNewCheckBox_9, "cell 0 2");
		
		chckbxNewCheckBox_15 = new JCheckBox("0.070\u201D x 31\u201D x 38\u201D");
		absPanel.add(chckbxNewCheckBox_15, "cell 1 2");
		
		chckbxNewCheckBox_10 = new JCheckBox("0.230\u201D x 27\u201D x 25.5\u201D");
		absPanel.add(chckbxNewCheckBox_10, "cell 0 3");
		
		chckbxNewCheckBox_16 = new JCheckBox("0.165\u201D x 15\u201D x 23.25");
		absPanel.add(chckbxNewCheckBox_16, "cell 1 3");
		
		chckbxNewCheckBox_11 = new JCheckBox("0.070\u201D x 22\u201D x 35\u201D");
		absPanel.add(chckbxNewCheckBox_11, "cell 0 4");
		
		chckbxNewCheckBox_12 = new JCheckBox("0.165\u201D x 19.5\u201D x 23.25\u201D");
		absPanel.add(chckbxNewCheckBox_12, "cell 0 5");
		
		burbujaTab = new JPanel();
		tabContainer.addTab("Burbuja", null, burbujaTab, null);
		burbujaTab.setLayout(new BorderLayout(0, 0));
		
		burbujaPanel = new JPanel();
		burbujaTab.add(burbujaPanel);
		burbujaPanel.setLayout(new MigLayout("", "[214px][214px]", "[33px][33px][33px][33px][33px][33px]"));
		
		chckbxNewCheckBox_17 = new JCheckBox("3/16\u201D x 1.22\u201D x 123 mts");
		burbujaPanel.add(chckbxNewCheckBox_17, "cell 0 0");
		
		chckbxNewCheckBox_18 = new JCheckBox("3/16\u201D x 1.22\u201D x 123 mts");
		burbujaPanel.add(chckbxNewCheckBox_18, "cell 0 1");
		
		chckbxNewCheckBox_19 = new JCheckBox("1/2\u201D x 1.22\u201D x 61.5 mts  punteada a 12");
		burbujaPanel.add(chckbxNewCheckBox_19, "cell 0 2");
		
		chckbxNewCheckBox_20 = new JCheckBox("1/2 \u201C x 1.22\u201D x 61.5 mts");
		burbujaPanel.add(chckbxNewCheckBox_20, "cell 0 3");
		
		cartonTab = new JPanel();
		tabContainer.addTab("Carton", null, cartonTab, null);
		cartonTab.setLayout(new BorderLayout(0, 0));
		
		cartonPanel = new JPanel();
		cartonTab.add(cartonPanel, BorderLayout.CENTER);
		cartonPanel.setLayout(new MigLayout("", "[214px][214px]", "[33px][33px][33px][33px][33px][33px]"));
		
		chckbxNewCheckBox_21 = new JCheckBox("85\u201D x 117\u201D 29 ect-c Kraft");
		
		cartonPanel.add(chckbxNewCheckBox_21, "cell 0 0");
		
		chckbxNewCheckBox_22 = new JCheckBox("91\u201D x 92\u201D 32 ect-c Kraft");
		cartonPanel.add(chckbxNewCheckBox_22, "cell 0 1");
		
		chckbxNewCheckBox_23 = new JCheckBox("85\u201D x 117\u201D 200 BC Kraft");
		cartonPanel.add(chckbxNewCheckBox_23, "cell 0 2");
		
		chckbxNewCheckBox_24 = new JCheckBox("91\u201D x 94\u201D 200 BC Kraft");
		cartonPanel.add(chckbxNewCheckBox_24, "cell 0 3");
		
		foamTab = new JPanel();
		tabContainer.addTab("Foam", null, foamTab, null);
		foamTab.setLayout(new BorderLayout(0, 0));
		
		foamPanel = new JPanel();
		foamTab.add(foamPanel, BorderLayout.CENTER);
		foamPanel.setLayout(new MigLayout("", "[214px][214px]", "[33px][33px][33px][33px][33px][33px]"));
		
		chckbxNewCheckBox_25 = new JCheckBox("3/32\u201D x 76\u201D x 459");
		foamPanel.add(chckbxNewCheckBox_25, "cell 0 0");
		
		chckbxNewCheckBox_26 = new JCheckBox("1/8\u201D x 76\u201D x 459");
		foamPanel.add(chckbxNewCheckBox_26, "cell 0 1");
		
		chckbxNewCheckBox_27 = new JCheckBox("1/4\u201D x 76\u201D x 180");
		foamPanel.add(chckbxNewCheckBox_27, "cell 0 2");
		
		chckbxNewCheckBox_28 = new JCheckBox("1/8\u201D x 72\u201D x 345");
		foamPanel.add(chckbxNewCheckBox_28, "cell 0 3");
		
		chckbxNewCheckBox_29 = new JCheckBox("1/16\u201D x 72\u201D x 689");
		foamPanel.add(chckbxNewCheckBox_29, "cell 0 4");
		
		plasticoTab = new JPanel();
		tabContainer.addTab("Plastico", null, plasticoTab, null);
		plasticoTab.setLayout(new BorderLayout(0, 0));
		
		plasticoPanel = new JPanel();
		plasticoTab.add(plasticoPanel, BorderLayout.CENTER);
		plasticoPanel.setLayout(new MigLayout("", "[214px][214px]", "[33px][33px][33px][33px][33px][33px]"));
		
		chckbxNewCheckBox_30 = new JCheckBox("3mm x 48\u201D x 96\u201D");
		plasticoPanel.add(chckbxNewCheckBox_30, "cell 0 0");
		
		chckbxNewCheckBox_31 = new JCheckBox("4mm x 48\u201D x 96\u201D");
		plasticoPanel.add(chckbxNewCheckBox_31, "cell 0 1");
		
		chckbxNewCheckBox_32 = new JCheckBox("5mm x 48\u201D x 96\u201D");
		plasticoPanel.add(chckbxNewCheckBox_32, "cell 0 2");
		
		chckbxNewCheckBox_33 = new JCheckBox("6mm x 48\u201D x 96\u201D");
		plasticoPanel.add(chckbxNewCheckBox_33, "cell 0 3");
		
		chckbxNewCheckBox_34 = new JCheckBox("8mm x 48\u201D x 96\u201D");
		plasticoPanel.add(chckbxNewCheckBox_34, "cell 0 4");
		
		buttonsPanel = new JPanel();
		outsidePanel.add(buttonsPanel, BorderLayout.SOUTH);
		buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5));
		
		btnAceptar = new JButton("Aceptar");
		buttonsPanel.add(btnAceptar);
		
		btnCancelar = new JButton("Cancelar");
		btnCancelar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				dispose();
			}
		});
		buttonsPanel.add(btnCancelar);
	}
	public void itemStateChanged(ItemEvent e){
		JCheckBox source = (JCheckBox) e.getSource();
		String text ="";
		if(source.isSelected()){
			text = source.getText();
			System.out.println(text);
		}
		else{
			System.out.println("Deselected");
		}
	
	}

}
